﻿@page "/ajax"

<h3>@Localizer["AjaxTitle"]</h3>

<h4>@Localizer["AjaxDescribe"]</h4>

<DemoBlock Introduction="@Localizer["NormalIntro"]" Title="@Localizer["NormalTitle"]" Name="Normal">
    <p>
        <b>@Localizer["NormalB"]</b>
        <div>@((MarkupString)Localizer["NormalDiv"].Value)</div>
    </p>
    <Pre>var option = new AjaxOption
{
    Url = "/api/Login",
    Data = new User() { UserName = "admin", Password = "1234567" }
};
var result = await AjaxService.InvokeAsync(option);</Pre>

    <div>
        <Button OnClick="Success">@Localizer["NormalButtonText1"]</Button>
        <Button OnClick="Fail">@Localizer["NormalButtonText2"]</Button>
        @if (!string.IsNullOrEmpty(ResultMessage))
        {
            <div class="mt-3"><code>@ResultMessage</code></div>
        }
    </div>
</DemoBlock>

<DemoBlock Introduction="@Localizer["GoToIntro"]" Title="@Localizer["GoToTitle"]" Name="GoTo">
    <Button OnClick="Goto">@Localizer["GoToButtonText1"]</Button>
    <Button OnClick="GotoSelf">@Localizer["GoToButtonText2"]</Button>
</DemoBlock>

<MethodTable Items="@GetMethods()" />
